class Node:
    def __init__(self,cols):
        if cols[0]=="buy":
            self.style="buy"
            self.p=float(cols[1])
            self.s=int(cols[2])
            self.flag=True
        elif cols[0]=="sell":
            self.style="sell"
            self.p=float(cols[1])
            self.s=int(cols[2])
            self.flag=True
        else:
            self.style="cancel"
            self.s=int(cols[1])-1
            self.flag=False

    def __print__(self):
        if self.style!="cancel":
            print(self.p,self.s,self.flag)

nodes=[]
while True:
    try:
        line=input()
        cols=line.split()
        nodes.append(Node(cols))
        if cols[0]=="cancel":
            nodes[int(cols[1])-1].flag=False
    except:
        break
    
nodes_buy=[]
nodes_sell=[]
for node in nodes:
    if node.flag==False:
        continue
    if node.style=="buy":
        nodes_buy.append(node)
    else:
        nodes_sell.append(node)


max_price=0
max_count=0
for node in nodes_buy:
    price=node.p
    count_sell=0
    count_buy=0
    for n_s in nodes_sell:
        if n_s.p<=price:
            count_sell+=n_s.s
    for n_b in nodes_buy:
        if n_b.p>=price:
            count_buy+=n_b.s
    count=min(count_sell,count_buy)

    if count>max_count or (count==max_count and price>max_price):
        max_price=price
        max_count=count

print("%.2f"%max_price,max_count)
